package yxy.apple.util.concurrent;

/**  */
public class ThreadConfig {
	/** 基本线程数 */
	public int BaseThreadPoolSize = 20;
	/** 单个处理器的线程数 */
	public int ExtraThreadPerCore = 4;
	/** 线程运行超时警报时间线 毫秒 */
	public long MaxRuntimeMillisecWithoutWarning = 5000;

	/** 线程池大小 */
	private int ThreadPoolSize;

	public int getThreadPoolSize() {
		if (ThreadPoolSize <= 0) {
			ThreadPoolSize = BaseThreadPoolSize + Runtime.getRuntime().availableProcessors() * ExtraThreadPerCore;
		}
		return ThreadPoolSize;
	}
}